package io.renren.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.dao.AppColumnLinkDao;
import io.renren.dto.ColumnAppDto;
import io.renren.entity.App;
import io.renren.entity.AppColumnLink;
import io.renren.service.AppColumnLinkService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("appColumnLinkService")
public class AppColumnLinkServiceImpl extends ServiceImpl<AppColumnLinkDao, AppColumnLink> implements AppColumnLinkService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<AppColumnLink> page = this.selectPage(
                new Query<AppColumnLink>(params).getPage(),
                new EntityWrapper<>()
        );

        return new PageUtils(page);
    }


    @Override
    public List<ColumnAppDto> getColumnAppList(int limit) {
        return baseMapper.getColumnAppList( limit );
    }

    @Override
    public List<App> queryAppByColumn(Integer page, Integer limit, Integer columnId) {
        return baseMapper.queryAppByColumn( new Page<App>( page, limit ), columnId );
    }
}
